import { join } from 'path';
import { dialog } from 'electron'
import { Name } from './interface';
import config from './config'

export default function Openfile(name: Name) {
    return new Promise(res => {
        const p = join(config.homedir, name)
        const v = dialog.showOpenDialog({
            defaultPath: p
        })
        v.then(e => {
            res(e)
        })
        v.catch(() => {
            res(false)
        })
    })
}